{extend name="property/public/insidePageBase" /}
{block name="title"}汇报至我的{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form layui-form-pane" action="">
            <div class="layui-inline">
                <label class="layui-form-label">按汇报类型</label>
                <div class="layui-input-inline" style="width: 128px;">
                    <select name="flow_type"  lay-search>
                        <option value="">--请选择--</option>
                        {foreach $reportTypeData as $k=>$v}
                        <option value="{$k}">{$v}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">按阅读状态</label>
                <div class="layui-input-inline" style="width: 128px;">
                    <select name="is_check"  lay-search>
                        <option value="">--请选择--</option>
                        <option value="1">未阅读</option>
                        <option value="2">己阅读</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">关键词搜索</label>
                <div class="layui-input-inline">
                    <input type="text" name="keywords" autocomplete="off" class="layui-input" placeholder="请输入关键词搜索信息">
                </div>
            </div>
            <div class="layui-inline">
                <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
            </div>
        </form>
        <table class="layui-hide" id="workReportSubmitList" lay-filter="workReportSubmitList"></table>
        <script type="text/html" id="tableBar">
            <div class="layui-btn-group">
                {if $readAuth}<a class="layui-btn layui-btn-sm  layui-btn-normal" lay-event="details">查阅</a>{/if}
            </div>
        </script>
        <script type="text/html" id="report_name_tpl">
            {{# if(d.source_info) { }}
                {{d.source_info.report_name}}
            {{# } }}
        </script>
        <script type="text/html" id="is_check_tpl">
            {{# if(d.is_check === 1) { }}<span class="layui-badge layui-bg-cyan">未读</span>{{# } }}
            {{# if(d.is_check === 2) { }}<span class="layui-badge layui-bg-green">己读</span>{{# } }}
        </script>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
    <script>
        layui.use(['form', 'table'], function () {
            var $ = layui.jquery, form = layui.form, table = layui.table;
            var tableId = 'workReportSubmitList';
            table.render({
                elem: '#'+tableId,
                id:tableId,
                url: '{:url("propertyWorkReportReportToMeList")}',
                toolbar: '#toolbar',
                cols: [[
                    {type: "checkbox", width: 50, rowspan: 2},
                    {field: 'report_name', width: 328, title: '标题', rowspan: 2, templet:'#report_name_tpl'},
                    {field: 'flow_type', width: 88, title: '类型', sort: true, rowspan: 2},
                    {field: 'is_check', width: 88, title: '状态', sort: true, rowspan: 2, templet:'#is_check_tpl'},
                    {field: 'remark',width: 168, title: '备注说明', rowspan: 2},
                    {field: 'add_time', width: 168, title: '接收时间', sort: true},
                    {title: '操作', minWidth: 128, toolbar: '#tableBar', rowspan: 2, fixed:'right'}
                ]],
                limits: [10, 15, 20, 25, 50, 100],
                limit: 15,
                page: true,
                height: 'full-80'
            });
            // 监听搜索操作
            form.on('submit(data-search-btn)', function (data) {table.reload(tableId, {page: { curr: 1  }, where: data.field}, 'data'); return false; });
            table.on('rowDouble('+tableId+')', function(obj){
                var data = obj.data;
                var url = '{:url("propertyWorkReportReportReadInfo")}?receives_id='+data.id;
                parent.layer.open({
                    title: '查阅 ' + data.source_info.report_name, type: 2, shade: 0.2, maxmin:true, shadeClose:true, move:false,area: ['1000px', '100%'],offset:  'rt', anim: 2, content: url , btn: false
                });
            });
            //监听表格复选框选择
            table.on('checkbox('+tableId+')', function (obj) {
                console.log(obj)
            });
            table.on('tool('+tableId+')', function (obj) {
                var data = obj.data;
               if (obj.event === 'details') {
                    var url = '{:url("propertyWorkReportReportReadInfo")}?receives_id='+data.id;
                    var index = parent.layer.open({title: '查阅 ' + data.source_info.report_name, type: 2, shade: 0.2, maxmin:true, shadeClose:true, move:false,area: ['1000px', '100%'],offset:  'rt', anim: 2, content: url , btn:false });
                    return false;
                }
            });
        });
    </script>
{/block}